{% extends "common/base.side.html" %}

{% block title %}
    Role Edit
{% endblock %}

{% block head %}
    <script src="/static/js/jquery.bootstrap-duallistbox.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-duallistbox.css">
{% endblock %}

{% block rcontent %}
    <div class="btn-toolbar">
        <div class="btn-group">
            {% url "addblogurl" as theaddroleurl %}
            <a class="btn btn-default {%if request.path == theaddroleurl%} active {%endif%}" href={{ theaddroleurl }}>
                <span class="glyphicon glyphicon-edit"></span>添加博客</a>
            {% url "bloglisturl" as thelistblogurl %}
            <a class="btn btn-default {%if request.path == thelistblogurl%} active {%endif%}" href={{ thelistblogurl }}>
                <span class="glyphicon glyphicon-list"></span>博客列表</a>
        </div>
    </div>

    <hr/>

    <form class="form-horizontal" role="form" action={% url "commentblogurl" ID %} method="POST" >
    {% csrf_token %}

        {% for item in form %}
            <div class="form-group">
                <label class="control-label col-md-1">{{item.label}}</label>
                <div class="col-md-11">
                    {{item}}
                </div>
                <div class="col-md-offset-1 col-md-10">
                    {{item.errors}}
                </div>
            </div>
        {% endfor %}

        <div class="form-group">
            <div class="col-md-offset-1 col-md-10">
                <button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('确认更新吗？')">更 新</button>
            <div>
        </div>

    </form>

    <script>
        var demo1 = $('select[name="permission"]').bootstrapDualListbox({
              nonSelectedListLabel: '可选择权限',
              selectedListLabel: '已选择权限',
              preserveSelectionOnMove: 'moved',
              moveOnSelect: false,
        });
        jQuery(function ($) {
            $('form').bind('submit', function () {
                $(this).find(':input').prop('disabled', false);
            });
        });
    </script>

{% endblock %}
